//
//  EmoticonsModel.m
//  微博
//
//  Created by zxy on 2019/1/9.
//  Copyright © 2019 zxy. All rights reserved.
//

#import "EmoticonsModel.h"

@implementation EmoticonsModel
+(NSDictionary *)mj_objectClassInArray{
    return @{
             @"emoticons":@"EmoticonsImageModel"
             };
}
+(NSDictionary *)mj_replacedKeyFromPropertyName{
    
    return @{
             @"emojiid": @"id"
             };
}



-(NSMutableArray *)emoticons{
    //获取每类表情需要追加多少个按钮,每一页如果不够21，就追究空白的按钮
    NSInteger count = _emoticons.count % 21;
    for (NSInteger i = count; i < 20; i++) {//因为最后一个是要显示删除按钮，所以判断<20
        EmoticonsImageModel *model = [[EmoticonsImageModel alloc] initIsRemoveButton:NO];
        //追加空白按钮
        [_emoticons addObject: model];
    }
    //最后一个显示删除按钮
    EmoticonsImageModel *model = [[EmoticonsImageModel alloc] initIsRemoveButton:YES];
    [_emoticons addObject:model];
    
    
    return _emoticons;
}
@end

@implementation EmoticonsImageModel
+(NSDictionary *)mj_replacedKeyFromPropertyName{
    return @{
             @"emojiid": @"id"
             };
}

- (instancetype)initIsRemoveButton:(BOOL)isRemoveButton
{
    self = [super init];
    if (self) {
        self.isShowRemoveBtn = isRemoveButton;
    }
    return self;
}

-(NSString *)emojiStr{
    NSString *emojiStr = [NSString emojiWithStringCode:_code];
    return emojiStr;
}

@end
